package com.linciping.room.sample

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.widget.Button
import com.linciping.room.db.DBManager

class MainActivity : AppCompatActivity() {

    companion object {
        const val TAG = "MainActivity"
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        findViewById<Button>(R.id.btn_go_dao).setOnClickListener {
            val userDao = DBManager.getDao(UserDao::class.java)
            if (userDao != null) {
                Log.d(TAG, "获取UserDao成功")
            } else {
                Log.e(TAG, "获取UserDao失败")
            }
        }
    }
}